//	--------------------------------------------------------------------
//	Copyright(C) 2006,2007 Zhao Yukun. All rights reserved.
//	This file is a part of the Xeres system.
//	Xeres 2007
//	Contact : xeres.engine@gmail.com
//	$(reservedInfo)
//	$(reservedDeclaration)
//	--------------------------------------------------------------------
///	@file	<UiManager.h>
///	@path	~/src/appear/xwin/
///	@date	2008/09/09
///	@brief	.

#pragma once

#include "xeres.h"

#include "graphics/IEffect.h"
#include "graphics/ITechnique.h"
#include "graphics/canvas/CCanvas.h"

#include "gui/input/input.h"

#include "gui/composite/CCompositeTexture.h"

#include "engine/xcore/xeres_engine.h"

#include "appear/xwin/XAppDesktop.h"

namespace xeres {

	/*! 
		\class	UiManager
		\brief
	*/
	class UiManager
	{
	public:

		/// \ctor
		UiManager( void );

		/// \dtor
		~UiManager( void );

		/// \brief	Initialize UI Manager.
		void Initialize( void * window , InputDispatcher * dispatcher , Engine& engine );

		/// \brief	Finalize UI Manager.
		void Finalize( void );

		/// \name Basic Behavior
		//@{

		/// \brief	Tick updater.
		void Tick( const Frame& frame );

		/// \brief	Render.
		void Render( RenderContext& rc );

		///	\brief	Process key input message.
		HandleInput OnKeyInput( const KeyInput& input );

		///	\brief	Process mouse input message.
		HandleInput OnMouseInput( const MouseInput& input );

		/// \brief	OnSize
		void OnSize( Engine& engine , const Pair<int>& size );

		//@}

		/// \name Window Management.
		//@{

		/// \brief	Get desktop.
		RefWeak<XAppDesktop> GetDesktop( void ) { return m_desktop; }

		/// \brief	Toggle ui desktop.
		void ToggleDesktop( void );

		//@}

	private:

		//@ data
		InputDispatcher *			m_dispatcher;
		Ref<XAppDesktop>			m_desktop;

		// resources
	};

} // namespace xeres
